import request from "@/utils/request";
// 提交请假申请
export const submitLeaveRequest = (data) => {
    return request.post(`/leave/submit`, data);
};

// 取消待审核的请假申请
export const cancelPendingLeaveRequest = (id) => {
    return request.post(`/leave/cancel/pending/${id}`);
};

// 提交取消已批准的请假申请
export const submitCancelApprovedLeaveRequest = (id) => {
    return request.post(`/leave/cancel/approved/${id}`);
};

// 管理员审核请假申请
export const reviewLeaveRequest = (id, approve, adminId) => {
    return request.post(`/leave/review/${id}`, null, {
        params: { approve, adminId }
    });
};

// 管理员审核取消申请
export const reviewCancelRequest = (id, approve, adminId) => {
    return request.post(`/leave/review/cancel/${id}`, null, {
        params: { approve, adminId }
    });
};

// 查询请假申请列表
export const listLeaveRequests = (queryDTO) => {
    return request.get(`/leave/list`, { params: queryDTO });
};